# Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>
# Maintainer: Ronald van Haren <ronald.archlinux.org>

pkgname=qwt
pkgver=6.2.0
pkgrel=1
pkgdesc='Qt Widgets for Technical Applications'
url='https://qwt.sourceforge.io/'
arch=('x86_64')
depends=('qt5-base' 'qt5-svg')
optdepends=('qt5-tools: For Designer plugin')
makedepends=('qt5-tools')
provides=('qwtpolar')
replaces=('qwtpolar')
license=("custom:${pkgname}")
source=(https://downloads.sourceforge.net/${pkgname}/${pkgname}-${pkgver}.tar.bz2)
sha512sums=('d992f9dddb09ad0e1d09e23a24a9331c950ca19a413d2627cf423e1ddc2a4ad4eb951646f789e8c7a9ab42668c30d7108071f3f8bbd8e1f4118cadb67c34939d')

prepare() {
  cd ${pkgname}-${pkgver}

  sed -e '/^\s*QWT_INSTALL_PREFIX/ s|=.*|= /usr|' \
      -e '/^QWT_INSTALL_DOCS/ s|/doc|/share/doc/qwt|' \
      -e '/^QWT_INSTALL_HEADERS/ s|include|&/qwt|' \
      -e '/^QWT_INSTALL_PLUGINS/ s|plugins/designer|lib/qt/&|' \
      -e '/^QWT_INSTALL_FEATURES/ s|features|lib/qt/mkspecs/&|' \
      -i qwtconfig.pri
}

build() {
  cd ${pkgname}-${pkgver}
  qmake-qt5 qwt.pro
  make
}

package() {
  cd ${pkgname}-${pkgver}
  make INSTALL_ROOT="${pkgdir}" install

  mv "${pkgdir}/usr/share/doc/qwt/man" "${pkgdir}/usr/share"
  install -Dm 644 COPYING -t "${pkgdir}/usr/share/licenses/${pkgname}"
}

# vim: ts=2 sw=2 et:
